const request = require("/util/request")

// 查询订单列表
export function page(data) {
  return request({
    url: 'order/app/page',
    method: 'POST',
    data: data
  })
}
// 订单下单
export function save(data) {
  return request({
    url: 'order/app/save-order',
    method: 'POST',
    data: data
  })
}
// 查询订单详情
export function detail(id) {
  return request({
    url: `order/app/${id}/order-info`,
    method: 'GET',
  })
}
// 取消订单
export function canOrder(id, data) {
  return request({
    url: `order/app/${id}/request-cancel-order`,
    method: 'POST',
    methodType: 'application',
    data: data
  })
}
// 申请取消
export function reqCanOrder(id, data) {
  return request({
    url: `order/app/${id}/cancel-order`,
    method: 'POST',
    methodType: 'application',
    data: data
  })
}
// 撤销=申请取消
export function repeal(id) {
  return request({
    url: `order/app/${id}/request-cancel-order/repeal`,
    method: 'POST',
    methodType: 'application',
  })
}

// 支付订单
export function alipay(oid, id) {
  return request({
    url: `order/app/${oid}/pay-order/${id}/record`,
    method: 'POST',
    methodType: 'application'
  })
}
// 预授权
export function freeze(id) {
  return request({
    url: `order/app/${id}/freeze`,
    method: 'POST',
    methodType: 'application'
  })
}
// 查看物流
export function getOne(id, data) {
  return request({
    url: `pd/getOneNew`,
    method: 'get',
    data: data,
    // methodType:'application'
  })
}
// 确认收货
export function receiving(id) {
  return request({
    url: `order/app/${id}/receiving`,
    method: 'GET',

  })
}
// 归还物品
export function giveBack(data) {
  return request({
    url: `order/app/giveBack`,
    method: 'post',
    data: data

  })
}

// 买断物品
export function buyout(oid) {

  return request({
    url: `order/app/${oid}/buyout`,
    method: 'post',
  })
}

// 签署协议
// lease.treasure.alipay-app.dashengzuji.com
export function sign(oid) {
  return request({
    baseUrl2: 'https://lease.treasure.hfszzx.com/',
    url: `antBlockchain/${oid}`,
    method: 'GET'
  })
}